package com.cssw.fyzb.core.dao.pay;

import com.cssw.fyzb.core.model.dodb.*;
import com.cssw.fyzb.core.util.TimeUtil;
import com.ydn.dbframe.plugin.activerecord.Db;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.Date;

/**
 * @Author: yangyiqun
 * @Date: 2021/2/11 14:20
 */
@Repository
public class UserQuickSignDaoImpl implements UserQuickSignDao {

    @Override
    public Long save(Long userId, String cardNo, String realName, String bankName, String bankCode,
                     String certCode, String mobile, String orderNo, String idCard) {
        UserQuickSign userQuickSign = new UserQuickSign();
        userQuickSign.setUserId(userId);
        userQuickSign.setCardNo(cardNo);
        userQuickSign.setRealName(realName);
        userQuickSign.setBankName(bankName);
        userQuickSign.setBankCode(bankCode);
        userQuickSign.setCertCode(certCode);
        userQuickSign.setMobile(mobile);
        userQuickSign.setOrderNo(orderNo);
        userQuickSign.setIdCard(idCard);
        userQuickSign.setCreateTime(new Date());
        userQuickSign.save();
        return userQuickSign.getQuickId();
    }

    @Override
    public UserQuickSign getByUserId(Long userId) {
        String sql = "select * from t_user_quick_sign where user_id = ?";
        return UserQuickSign.dao.findFirst(sql, userId);
    }

    @Override
    public UserQuickSign getByUIdAndCardNo(Long userId, String cardNo) {
        String sql = "select * from t_user_quick_sign where user_id = ? and card_no = ?";
        return UserQuickSign.dao.findFirst(sql, userId, cardNo);
    }
}
